package common;

import freemarker.template.TemplateException;
import pro.shuangxi.generator.Generator;
import pro.shuangxi.source.MapSource;
import pro.shuangxi.source.MysqlTableMapSource;

import java.io.IOException;

/**
 * @author mengshx
 **/
public class CodeGeneratorMysql {
    public static void main(String[] args) throws IOException, TemplateException {
        MapSource source = getMysqlMapSource();
        String projectPath= System.getProperty("user.dir");
        Generator generator = new Generator(source);
        generator.setOutputPath(projectPath+"/render");
        generator.render(projectPath+"/template_shuangxi_adminv2");

    }

    private  static MapSource getMysqlMapSource(){
        MysqlTableMapSource source = new MysqlTableMapSource(
                "jdbc:mysql:///liling?useInformationSchema=true",
                "root",
                "admin",
                "sys_oper_log");
        source.setAuthor("mengshx");
        source.setPackage("pro.shuangxi.system.module.log");
        source.setPerfix("");
        source.setSuffix("");
        return source;
    }
}
